package com.ukao.cashregister.adapter;

import android.content.Context;
import android.widget.TextView;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.cashregister.R;
import com.ukao.cashregister.bean.serviceTimeBean;

import java.util.List;

/**
 * 下单派送时间
 */

public class ServiceTimeAdapter extends CommonAdapter<serviceTimeBean.ListBean> {


    private  String time;

    public ServiceTimeAdapter(Context context, List<serviceTimeBean.ListBean> datas,String time) {
        super(context, datas, R.layout.choose_time_item);
        this.time=time;


    }




    @Override
    public void convert(ViewHolder holder, serviceTimeBean.ListBean item) {
        TextView   tagTxt=holder.getView(R.id.tag_txt);
        //String  strTime=time+" "+item.getTimeEnd();
//        try {
//            long   currentime=System.currentTimeMillis();
//            long   mtime= MyDateUtils.getTimes(strTime,"yyyy-MM-dd HH:mm");
//
//            if (currentime>mtime){
//                tagTxt.setEnabled(false);
//                item.setEnableds(false);
//            }else{
//                item.setEnableds(true);
//                tagTxt.setEnabled(true);
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }

        tagTxt.setText(item.getTime());
        if (item.ischeck()){
                tagTxt.setBackgroundResource(R.drawable.add_list_item_checked);
                tagTxt.setTextColor(mContext.getResources().getColor(R.color.white));

        }else{

                tagTxt.setBackgroundResource(R.drawable.add_list_item);
                tagTxt.setTextColor(mContext.getResources().getColor(R.color.black));
            }



        }















}
